From 26bf76b48bbce3e7b126290374c64966dca47561 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roger=20Pau=20Monn=C3=A9?= Date: Wed, 26 Oct 2022 14:57:41 +0200 Subject: [PATCH] vpci: introduce a local vpci_bar variable to modify_decoding() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is done to shorten line length in the function in preparation for adding further usages of the vpci_bar data structure. No functional change. Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich Release-acked-by: Henry Wang --- xen/drivers/vpci/header.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index a1c928a0d2..eb9219a49a 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -103,24 +103,26 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd, for ( i = 0; i < ARRAY_SIZE(header->bars); i++ ) { - if ( !MAPPABLE_BAR(&header->bars[i]) ) + struct vpci_bar *bar = &header->bars[i]; + + if ( !MAPPABLE_BAR(bar) ) continue; - if ( rom_only && header->bars[i].type == VPCI_BAR_ROM ) + if ( rom_only && bar->type == VPCI_BAR_ROM ) { unsigned int rom_pos = (i == PCI_HEADER_NORMAL_NR_BARS) ? PCI_ROM_ADDRESS : PCI_ROM_ADDRESS1; - uint32_t val = header->bars[i].addr | + uint32_t val = bar->addr | (map ? PCI_ROM_ADDRESS_ENABLE : 0); - header->bars[i].enabled = header->rom_enabled = map; + bar->enabled = header->rom_enabled = map; pci_conf_write32(pdev->sbdf, rom_pos, val); return; } if ( !rom_only && - (header->bars[i].type != VPCI_BAR_ROM || header->rom_enabled) ) - header->bars[i].enabled = map; + (bar->type != VPCI_BAR_ROM || header->rom_enabled) ) + bar->enabled = map; } if ( !rom_only ) -- 2.30.2